package o;

import androidx.annotation.Nullable;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.id3.ApicFrame;
import com.google.android.exoplayer2.metadata.id3.BinaryFrame;
import com.google.android.exoplayer2.metadata.id3.ChapterFrame;
import com.google.android.exoplayer2.metadata.id3.ChapterTocFrame;
import com.google.android.exoplayer2.metadata.id3.CommentFrame;
import com.google.android.exoplayer2.metadata.id3.GeobFrame;
import com.google.android.exoplayer2.metadata.id3.Id3Frame;
import com.google.android.exoplayer2.metadata.id3.MlltFrame;
import com.google.android.exoplayer2.metadata.id3.PrivFrame;
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame;
import com.google.android.exoplayer2.metadata.id3.UrlLinkFrame;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

public final class ahm implements ahd {
    public static final int ˊ = anr.ᐝ("ID3");
    public static final d ॱ = aho.ˊ;
    @Nullable
    private final d ˏ;

    public interface d {
        boolean ˊ(int i, int i2, int i3, int i4, int i5);
    }

    static final class b {
        private final boolean ˎ;
        private final int ˏ;
        private final int ॱ;

        public b(int i, boolean z, int i2) {
            this.ˏ = i;
            this.ˎ = z;
            this.ॱ = i2;
        }
    }

    @androidx.annotation.Nullable
    private static com.google.android.exoplayer2.metadata.id3.Id3Frame ˊ(int r14, o.anc r15, boolean r16, int r17, @androidx.annotation.Nullable o.ahm.d r18) {
        /* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.JadxRuntimeException: Can't find immediate dominator for block B:201:? in {2, 7, 10, 18, 21, 22, 23, 35, 38, 41, 42, 46, 47, 48, 53, 56, 59, 62, 65, 66, 67, 68, 69, 70, 71, 73, 75, 77, 87, 89, 91, 96, 106, 107, 110, 119, 129, 130, 138, 139, 147, 157, 158, 167, 176, 185, 187, 192, 194, 195, 196, 197, 198, 199, 200, 202} preds:[]
	at jadx.core.dex.visitors.blocksmaker.BlockProcessor.computeDominators(BlockProcessor.java:129)
	at jadx.core.dex.visitors.blocksmaker.BlockProcessor.processBlocksTree(BlockProcessor.java:48)
	at jadx.core.dex.visitors.blocksmaker.BlockProcessor.rerun(BlockProcessor.java:44)
	at jadx.core.dex.visitors.blocksmaker.BlockFinallyExtract.visit(BlockFinallyExtract.java:57)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
	at jadx.core.ProcessClass.process(ProcessClass.java:37)
	at jadx.core.ProcessClass.processDependencies(ProcessClass.java:59)
	at jadx.core.ProcessClass.process(ProcessClass.java:42)
	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
	at jadx.api.JavaClass.decompile(JavaClass.java:62)
*/
        /*
        r2 = r15.ʽ();
        r3 = r15.ʽ();
        r4 = r15.ʽ();
        r0 = 3;
        if (r14 < r0) goto L_0x0051;
    L_0x000f:
        r5 = r15.ʽ();
    L_0x0013:
        r0 = 4;
        if (r14 != r0) goto L_0x0053;
    L_0x0016:
        r7 = r15.ʽॱ();
        if (r16 != 0) goto L_0x0034;
    L_0x001c:
        r0 = r7 & 255;
        r1 = r7 >> 8;
        r1 = r1 & 255;
        r1 = r1 << 7;
        r0 = r0 | r1;
        r1 = r7 >> 16;
        r1 = r1 & 255;
        r1 = r1 << 14;
        r0 = r0 | r1;
        r1 = r7 >> 24;
        r1 = r1 & 255;
        r1 = r1 << 21;
        r7 = r0 | r1;
    L_0x0034:
        r0 = 3;
        if (r14 < r0) goto L_0x0060;
    L_0x0037:
        r0 = r15.ॱॱ();
        r10 = r0;
    L_0x003c:
        if (r2 != 0) goto L_0x0063;
    L_0x003e:
        if (r3 != 0) goto L_0x0063;
    L_0x0040:
        if (r4 != 0) goto L_0x0063;
    L_0x0042:
        if (r5 != 0) goto L_0x0063;
    L_0x0044:
        if (r7 != 0) goto L_0x0063;
    L_0x0046:
        if (r10 != 0) goto L_0x0063;
    L_0x0048:
        r0 = r15.ॱ();
        r15.ˋ(r0);
        r0 = 0;
    L_0x0050:
        return r0;
    L_0x0051:
        r5 = 0;
        goto L_0x0013;
    L_0x0053:
        r0 = 3;
        if (r14 != r0) goto L_0x005b;
    L_0x0056:
        r7 = r15.ʽॱ();
        goto L_0x0034;
    L_0x005b:
        r7 = r15.ˏॱ();
        goto L_0x0034;
    L_0x0060:
        r0 = 0;
        r10 = r0;
        goto L_0x003c;
    L_0x0063:
        r0 = r15.ˋ();
        r12 = r0 + r7;
        r0 = r15.ॱ();
        if (r12 <= r0) goto L_0x007f;
    L_0x006f:
        r0 = "Id3Decoder";
        r1 = "Frame size exceeds remaining tag data";
        o.amz.ˏ(r0, r1);
        r0 = r15.ॱ();
        r15.ˋ(r0);
        r0 = 0;
        goto L_0x0050;
    L_0x007f:
        if (r18 == 0) goto L_0x008f;
    L_0x0081:
        r0 = r18;
        r1 = r14;
        r0 = r0.ˊ(r1, r2, r3, r4, r5);
        if (r0 != 0) goto L_0x008f;
    L_0x008a:
        r15.ˋ(r12);
        r0 = 0;
        goto L_0x0050;
    L_0x008f:
        r9 = 0;
        r8 = 0;
        r6 = 0;
        r1 = 0;
        r0 = 0;
        r11 = 3;
        if (r14 != r11) goto L_0x00bd;
    L_0x0097:
        r0 = r10 & 128;
        if (r0 == 0) goto L_0x00b7;
    L_0x009b:
        r1 = 1;
    L_0x009c:
        r0 = r10 & 64;
        if (r0 == 0) goto L_0x00b9;
    L_0x00a0:
        r8 = 1;
    L_0x00a1:
        r0 = r10 & 32;
        if (r0 == 0) goto L_0x00bb;
    L_0x00a5:
        r0 = 1;
    L_0x00a6:
        r9 = r1;
    L_0x00a7:
        if (r9 != 0) goto L_0x00ab;
    L_0x00a9:
        if (r8 == 0) goto L_0x00e7;
    L_0x00ab:
        r0 = "Id3Decoder";
        r1 = "Skipping unsupported compressed or encrypted frame";
        o.amz.ˏ(r0, r1);
        r15.ˋ(r12);
        r0 = 0;
        goto L_0x0050;
    L_0x00b7:
        r1 = 0;
        goto L_0x009c;
    L_0x00b9:
        r8 = 0;
        goto L_0x00a1;
    L_0x00bb:
        r0 = 0;
        goto L_0x00a6;
    L_0x00bd:
        r11 = 4;
        if (r14 != r11) goto L_0x00a7;
    L_0x00c0:
        r0 = r10 & 64;
        if (r0 == 0) goto L_0x00dd;
    L_0x00c4:
        r1 = 1;
    L_0x00c5:
        r0 = r10 & 8;
        if (r0 == 0) goto L_0x00df;
    L_0x00c9:
        r9 = 1;
    L_0x00ca:
        r0 = r10 & 4;
        if (r0 == 0) goto L_0x00e1;
    L_0x00ce:
        r8 = 1;
    L_0x00cf:
        r0 = r10 & 2;
        if (r0 == 0) goto L_0x00e3;
    L_0x00d3:
        r6 = 1;
    L_0x00d4:
        r0 = r10 & 1;
        if (r0 == 0) goto L_0x00e5;
    L_0x00d8:
        r0 = 1;
    L_0x00d9:
        r13 = r1;
        r1 = r0;
        r0 = r13;
        goto L_0x00a7;
    L_0x00dd:
        r1 = 0;
        goto L_0x00c5;
    L_0x00df:
        r9 = 0;
        goto L_0x00ca;
    L_0x00e1:
        r8 = 0;
        goto L_0x00cf;
    L_0x00e3:
        r6 = 0;
        goto L_0x00d4;
    L_0x00e5:
        r0 = 0;
        goto L_0x00d9;
    L_0x00e7:
        if (r0 == 0) goto L_0x00ef;
    L_0x00e9:
        r7 = r7 + -1;
        r0 = 1;
        r15.ˎ(r0);
    L_0x00ef:
        if (r1 == 0) goto L_0x00f7;
    L_0x00f1:
        r7 = r7 + -4;
        r0 = 4;
        r15.ˎ(r0);
    L_0x00f7:
        if (r6 == 0) goto L_0x00fd;
    L_0x00f9:
        r7 = ॱॱ(r15, r7);
    L_0x00fd:
        r0 = 84;
        if (r2 != r0) goto L_0x0141;
    L_0x0101:
        r0 = 88;
        if (r3 != r0) goto L_0x0141;
    L_0x0105:
        r0 = 88;
        if (r4 != r0) goto L_0x0141;
    L_0x0109:
        r0 = 2;
        if (r14 == r0) goto L_0x0110;
    L_0x010c:
        r0 = 88;
        if (r5 != r0) goto L_0x0141;
    L_0x0110:
        r0 = ˊ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0114:
        if (r0 != 0) goto L_0x013c;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0116:
        r1 = "Id3Decoder";	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r6 = new java.lang.StringBuilder;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r6.<init>();	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r8 = "Failed to decode frame: id=";	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r6 = r6.append(r8);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r2 = ˊ(r14, r2, r3, r4, r5);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r2 = r6.append(r2);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r3 = ", frameSize=";	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r2 = r2.append(r3);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r2 = r2.append(r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r2 = r2.toString();	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        o.amz.ˏ(r1, r2);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x013c:
        r15.ˋ(r12);
        goto L_0x0050;
    L_0x0141:
        r0 = 84;
        if (r2 != r0) goto L_0x014e;
    L_0x0145:
        r0 = ˊ(r14, r2, r3, r4, r5);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = ˎ(r15, r7, r0);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x014e:
        r0 = 87;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x0166;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0152:
        r0 = 88;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x0166;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0156:
        r0 = 88;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x0166;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x015a:
        r0 = 2;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r14 == r0) goto L_0x0161;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x015d:
        r0 = 88;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 != r0) goto L_0x0166;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0161:
        r0 = ˏ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0166:
        r0 = 87;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x0173;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x016a:
        r0 = ˊ(r14, r2, r3, r4, r5);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = ˋ(r15, r7, r0);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0173:
        r0 = 80;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x0188;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0177:
        r0 = 82;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x0188;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x017b:
        r0 = 73;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x0188;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x017f:
        r0 = 86;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 != r0) goto L_0x0188;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0183:
        r0 = ˎ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0188:
        r0 = 71;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x01a1;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x018c:
        r0 = 69;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x01a1;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0190:
        r0 = 79;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x01a1;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0194:
        r0 = 66;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 == r0) goto L_0x019b;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0198:
        r0 = 2;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r14 != r0) goto L_0x01a1;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x019b:
        r0 = ˋ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01a1:
        r0 = 2;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r14 != r0) goto L_0x01b6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01a4:
        r0 = 80;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01a8:
        r0 = 73;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01ac:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01b0:
        r0 = ˎ(r15, r7, r14);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01b6:
        r0 = 65;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01ba:
        r0 = 80;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01be:
        r0 = 73;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x01c6;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01c2:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 == r0) goto L_0x01b0;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01c6:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x01df;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01ca:
        r0 = 79;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x01df;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01ce:
        r0 = 77;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x01df;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01d2:
        r0 = 77;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 == r0) goto L_0x01d9;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01d6:
        r0 = 2;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r14 != r0) goto L_0x01df;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01d9:
        r0 = ॱ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01df:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x01fd;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01e3:
        r0 = 72;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x01fd;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01e7:
        r0 = 65;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x01fd;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01eb:
        r0 = 80;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 != r0) goto L_0x01fd;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01ef:
        r6 = r15;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r8 = r14;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r9 = r16;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r10 = r17;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r11 = r18;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = ˎ(r6, r7, r8, r9, r10, r11);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x01fd:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x021b;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0201:
        r0 = 84;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x021b;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0205:
        r0 = 79;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x021b;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0209:
        r0 = 67;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 != r0) goto L_0x021b;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x020d:
        r6 = r15;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r8 = r14;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r9 = r16;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r10 = r17;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r11 = r18;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = ˊ(r6, r7, r8, r9, r10, r11);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x021b:
        r0 = 77;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r2 != r0) goto L_0x0231;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x021f:
        r0 = 76;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r3 != r0) goto L_0x0231;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0223:
        r0 = 76;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r4 != r0) goto L_0x0231;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0227:
        r0 = 84;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        if (r5 != r0) goto L_0x0231;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x022b:
        r0 = ᐝ(r15, r7);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
    L_0x0231:
        r0 = ˊ(r14, r2, r3, r4, r5);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = ˏ(r15, r7, r0);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        goto L_0x0114;
    L_0x023b:
        r0 = move-exception;
        r0 = "Id3Decoder";	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r1 = "Unsupported character encoding";	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        o.amz.ˏ(r0, r1);	 Catch:{ UnsupportedEncodingException -> 0x023b, all -> 0x0249 }
        r0 = 0;
        r15.ˋ(r12);
        goto L_0x0050;
    L_0x0249:
        r0 = move-exception;
        r15.ˋ(r12);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.ahm.ˊ(int, o.anc, boolean, int, o.ahm$d):com.google.android.exoplayer2.metadata.id3.Id3Frame");
    }

    public ahm() {
        this(null);
    }

    public ahm(@Nullable d dVar) {
        this.ˏ = dVar;
    }

    @Nullable
    public Metadata ˊ(ahg o_ahg) {
        ByteBuffer byteBuffer = o_ahg.ॱ;
        return ˏ(byteBuffer.array(), byteBuffer.limit());
    }

    @Nullable
    public Metadata ˏ(byte[] bArr, int i) {
        List arrayList = new ArrayList();
        anc o_anc = new anc(bArr, i);
        b ˎ = ˎ(o_anc);
        if (ˎ == null) {
            return null;
        }
        boolean z;
        int ˋ = o_anc.ˋ();
        int i2 = ˎ.ˏ == 2 ? 6 : 10;
        int ˋ2 = ˎ.ॱ;
        if (ˎ.ˎ) {
            ˋ2 = ॱॱ(o_anc, ˎ.ॱ);
        }
        o_anc.ॱ(ˋ2 + ˋ);
        if (ॱ(o_anc, ˎ.ˏ, i2, false)) {
            z = false;
        } else if (ˎ.ˏ == 4 && ॱ(o_anc, 4, i2, true)) {
            z = true;
        } else {
            amz.ˏ("Id3Decoder", "Failed to validate ID3 tag with majorVersion=" + ˎ.ˏ);
            return null;
        }
        while (o_anc.ˊ() >= i2) {
            Id3Frame ˊ = ˊ(ˎ.ˏ, o_anc, z, i2, this.ˏ);
            if (ˊ != null) {
                arrayList.add(ˊ);
            }
        }
        return new Metadata(arrayList);
    }

    @Nullable
    private static b ˎ(anc o_anc) {
        if (o_anc.ˊ() < 10) {
            amz.ˏ("Id3Decoder", "Data too short to be an ID3 tag");
            return null;
        }
        int ˏॱ = o_anc.ˏॱ();
        if (ˏॱ != ˊ) {
            amz.ˏ("Id3Decoder", "Unexpected first three bytes of ID3 tag header: " + ˏॱ);
            return null;
        }
        int i;
        boolean z;
        int ʽ = o_anc.ʽ();
        o_anc.ˎ(1);
        int ʽ2 = o_anc.ʽ();
        ˏॱ = o_anc.ʿ();
        if (ʽ == 2) {
            int i2;
            if ((ʽ2 & 64) != 0) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            if (i2 != 0) {
                amz.ˏ("Id3Decoder", "Skipped ID3 tag with majorVersion=2 and undefined compression scheme");
                return null;
            }
            i = ˏॱ;
        } else if (ʽ == 3) {
            if (((ʽ2 & 64) != 0 ? 1 : 0) != 0) {
                i = o_anc.ॱᐝ();
                o_anc.ˎ(i);
                ˏॱ -= i + 4;
            }
            i = ˏॱ;
        } else if (ʽ == 4) {
            if (((ʽ2 & 64) != 0 ? 1 : 0) != 0) {
                i = o_anc.ʿ();
                o_anc.ˎ(i - 4);
                ˏॱ -= i;
            }
            if ((ʽ2 & 16) != 0) {
                i = 1;
            } else {
                i = 0;
            }
            if (i != 0) {
                ˏॱ -= 10;
            }
            i = ˏॱ;
        } else {
            amz.ˏ("Id3Decoder", "Skipped ID3 tag with unsupported majorVersion=" + ʽ);
            return null;
        }
        if (ʽ >= 4 || (ʽ2 & DnsConfig.MAX_CACHE_ENTRIES) == 0) {
            z = false;
        } else {
            z = true;
        }
        return new b(ʽ, z, i);
    }

    private static boolean ॱ(anc o_anc, int i, int i2, boolean z) {
        int ˋ = o_anc.ˋ();
        while (o_anc.ˊ() >= i2) {
            int ॱॱ;
            int ॱᐝ;
            long j;
            long ˋॱ;
            if (i >= 3) {
                ˋॱ = o_anc.ˋॱ();
                ॱॱ = o_anc.ॱॱ();
                ॱᐝ = o_anc.ॱᐝ();
                j = ˋॱ;
            } else {
                ˋॱ = (long) o_anc.ˏॱ();
                ॱॱ = 0;
                ॱᐝ = o_anc.ˏॱ();
                j = ˋॱ;
            }
            if (ॱᐝ == 0 && j == 0 && ॱॱ == 0) {
                o_anc.ˋ(ˋ);
                return true;
            }
            long j2;
            Object obj;
            Object obj2;
            if (i != 4 || z) {
                j2 = j;
            } else if ((8421504 & j) != 0) {
                o_anc.ˋ(ˋ);
                return false;
            } else {
                j2 = (((j >> 24) & 255) << 21) | (((255 & j) | (((j >> 8) & 255) << 7)) | (((j >> 16) & 255) << 14));
            }
            Object obj3;
            if (i == 4) {
                obj = (ॱॱ & 64) != 0 ? 1 : null;
                obj3 = (ॱॱ & 1) != 0 ? 1 : null;
                obj2 = obj;
                obj = obj3;
            } else if (i == 3) {
                obj = (ॱॱ & 32) != 0 ? 1 : null;
                obj3 = (ॱॱ & DnsConfig.MAX_CACHE_ENTRIES) != 0 ? 1 : null;
                obj2 = obj;
                obj = obj3;
            } else {
                obj2 = null;
                obj = null;
            }
            int i3 = 0;
            if (obj2 != null) {
                i3 = 1;
            }
            if (obj != null) {
                i3 += 4;
            }
            if (j2 < ((long) i3)) {
                o_anc.ˋ(ˋ);
                return false;
            } else if (((long) o_anc.ˊ()) < j2) {
                return false;
            } else {
                try {
                    o_anc.ˎ((int) j2);
                } finally {
                    o_anc.ˋ(ˋ);
                }
            }
        }
        o_anc.ˋ(ˋ);
        return true;
    }

    @Nullable
    private static TextInformationFrame ˊ(anc o_anc, int i) throws UnsupportedEncodingException {
        if (i < 1) {
            return null;
        }
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[(i - 1)];
        o_anc.ˎ(bArr, 0, i - 1);
        int ˎ2 = ˎ(bArr, 0, ʽ);
        String str = new String(bArr, 0, ˎ2, ˎ);
        ˎ2 += ˏ(ʽ);
        return new TextInformationFrame("TXXX", str, ˊ(bArr, ˎ2, ˎ(bArr, ˎ2, ʽ), ˎ));
    }

    @Nullable
    private static TextInformationFrame ˎ(anc o_anc, int i, String str) throws UnsupportedEncodingException {
        if (i < 1) {
            return null;
        }
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[(i - 1)];
        o_anc.ˎ(bArr, 0, i - 1);
        return new TextInformationFrame(str, null, new String(bArr, 0, ˎ(bArr, 0, ʽ), ˎ));
    }

    @Nullable
    private static UrlLinkFrame ˏ(anc o_anc, int i) throws UnsupportedEncodingException {
        if (i < 1) {
            return null;
        }
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[(i - 1)];
        o_anc.ˎ(bArr, 0, i - 1);
        int ˎ2 = ˎ(bArr, 0, ʽ);
        ʽ = ˏ(ʽ) + ˎ2;
        return new UrlLinkFrame("WXXX", new String(bArr, 0, ˎ2, ˎ), ˊ(bArr, ʽ, ॱ(bArr, ʽ), "ISO-8859-1"));
    }

    private static UrlLinkFrame ˋ(anc o_anc, int i, String str) throws UnsupportedEncodingException {
        byte[] bArr = new byte[i];
        o_anc.ˎ(bArr, 0, i);
        return new UrlLinkFrame(str, null, new String(bArr, 0, ॱ(bArr, 0), "ISO-8859-1"));
    }

    private static PrivFrame ˎ(anc o_anc, int i) throws UnsupportedEncodingException {
        byte[] bArr = new byte[i];
        o_anc.ˎ(bArr, 0, i);
        int ॱ = ॱ(bArr, 0);
        return new PrivFrame(new String(bArr, 0, ॱ, "ISO-8859-1"), ॱ(bArr, ॱ + 1, bArr.length));
    }

    private static GeobFrame ˋ(anc o_anc, int i) throws UnsupportedEncodingException {
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[(i - 1)];
        o_anc.ˎ(bArr, 0, i - 1);
        int ॱ = ॱ(bArr, 0);
        String str = new String(bArr, 0, ॱ, "ISO-8859-1");
        ॱ++;
        int ˎ2 = ˎ(bArr, ॱ, ʽ);
        String ˊ = ˊ(bArr, ॱ, ˎ2, ˎ);
        ˎ2 += ˏ(ʽ);
        int ˎ3 = ˎ(bArr, ˎ2, ʽ);
        return new GeobFrame(str, ˊ, ˊ(bArr, ˎ2, ˎ3, ˎ), ॱ(bArr, ˏ(ʽ) + ˎ3, bArr.length));
    }

    private static ApicFrame ˎ(anc o_anc, int i, int i2) throws UnsupportedEncodingException {
        String str;
        int i3 = 2;
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[(i - 1)];
        o_anc.ˎ(bArr, 0, i - 1);
        if (i2 == 2) {
            str = "image/" + anr.ˎ(new String(bArr, 0, 3, "ISO-8859-1"));
            if ("image/jpg".equals(str)) {
                str = "image/jpeg";
            }
        } else {
            i3 = ॱ(bArr, 0);
            str = anr.ˎ(new String(bArr, 0, i3, "ISO-8859-1"));
            if (str.indexOf(47) == -1) {
                str = "image/" + str;
            }
        }
        int i4 = bArr[i3 + 1] & 255;
        i3 += 2;
        int ˎ2 = ˎ(bArr, i3, ʽ);
        return new ApicFrame(str, new String(bArr, i3, ˎ2 - i3, ˎ), i4, ॱ(bArr, ˏ(ʽ) + ˎ2, bArr.length));
    }

    @Nullable
    private static CommentFrame ॱ(anc o_anc, int i) throws UnsupportedEncodingException {
        if (i < 4) {
            return null;
        }
        int ʽ = o_anc.ʽ();
        String ˎ = ˎ(ʽ);
        byte[] bArr = new byte[3];
        o_anc.ˎ(bArr, 0, 3);
        String str = new String(bArr, 0, 3);
        bArr = new byte[(i - 4)];
        o_anc.ˎ(bArr, 0, i - 4);
        int ˎ2 = ˎ(bArr, 0, ʽ);
        String str2 = new String(bArr, 0, ˎ2, ˎ);
        ˎ2 += ˏ(ʽ);
        return new CommentFrame(str, str2, ˊ(bArr, ˎ2, ˎ(bArr, ˎ2, ʽ), ˎ));
    }

    private static ChapterFrame ˎ(anc o_anc, int i, int i2, boolean z, int i3, @Nullable d dVar) throws UnsupportedEncodingException {
        int ˋ = o_anc.ˋ();
        int ॱ = ॱ(o_anc.ˏ, ˋ);
        String str = new String(o_anc.ˏ, ˋ, ॱ - ˋ, "ISO-8859-1");
        o_anc.ˋ(ॱ + 1);
        ॱ = o_anc.ॱᐝ();
        int ॱᐝ = o_anc.ॱᐝ();
        long ˋॱ = o_anc.ˋॱ();
        if (ˋॱ == 4294967295L) {
            ˋॱ = -1;
        }
        long ˋॱ2 = o_anc.ˋॱ();
        if (ˋॱ2 == 4294967295L) {
            ˋॱ2 = -1;
        }
        ArrayList arrayList = new ArrayList();
        ˋ += i;
        while (o_anc.ˋ() < ˋ) {
            Id3Frame ˊ = ˊ(i2, o_anc, z, i3, dVar);
            if (ˊ != null) {
                arrayList.add(ˊ);
            }
        }
        Id3Frame[] id3FrameArr = new Id3Frame[arrayList.size()];
        arrayList.toArray(id3FrameArr);
        return new ChapterFrame(str, ॱ, ॱᐝ, ˋॱ, ˋॱ2, id3FrameArr);
    }

    private static ChapterTocFrame ˊ(anc o_anc, int i, int i2, boolean z, int i3, @Nullable d dVar) throws UnsupportedEncodingException {
        int ˋ = o_anc.ˋ();
        int ॱ = ॱ(o_anc.ˏ, ˋ);
        String str = new String(o_anc.ˏ, ˋ, ॱ - ˋ, "ISO-8859-1");
        o_anc.ˋ(ॱ + 1);
        ॱ = o_anc.ʽ();
        boolean z2 = (ॱ & 2) != 0;
        boolean z3 = (ॱ & 1) != 0;
        int ʽ = o_anc.ʽ();
        String[] strArr = new String[ʽ];
        for (ॱ = 0; ॱ < ʽ; ॱ++) {
            int ˋ2 = o_anc.ˋ();
            int ॱ2 = ॱ(o_anc.ˏ, ˋ2);
            strArr[ॱ] = new String(o_anc.ˏ, ˋ2, ॱ2 - ˋ2, "ISO-8859-1");
            o_anc.ˋ(ॱ2 + 1);
        }
        ArrayList arrayList = new ArrayList();
        ˋ += i;
        while (o_anc.ˋ() < ˋ) {
            Id3Frame ˊ = ˊ(i2, o_anc, z, i3, dVar);
            if (ˊ != null) {
                arrayList.add(ˊ);
            }
        }
        Id3Frame[] id3FrameArr = new Id3Frame[arrayList.size()];
        arrayList.toArray(id3FrameArr);
        return new ChapterTocFrame(str, z2, z3, strArr, id3FrameArr);
    }

    private static MlltFrame ᐝ(anc o_anc, int i) {
        int ॱॱ = o_anc.ॱॱ();
        int ˏॱ = o_anc.ˏॱ();
        int ˏॱ2 = o_anc.ˏॱ();
        int ʽ = o_anc.ʽ();
        int ʽ2 = o_anc.ʽ();
        ane o_ane = new ane();
        o_ane.ˊ(o_anc);
        int i2 = ((i - 10) * 8) / (ʽ + ʽ2);
        int[] iArr = new int[i2];
        int[] iArr2 = new int[i2];
        for (int i3 = 0; i3 < i2; i3++) {
            int ॱ = o_ane.ॱ(ʽ);
            int ॱ2 = o_ane.ॱ(ʽ2);
            iArr[i3] = ॱ;
            iArr2[i3] = ॱ2;
        }
        return new MlltFrame(ॱॱ, ˏॱ, ˏॱ2, iArr, iArr2);
    }

    private static BinaryFrame ˏ(anc o_anc, int i, String str) {
        byte[] bArr = new byte[i];
        o_anc.ˎ(bArr, 0, i);
        return new BinaryFrame(str, bArr);
    }

    private static int ॱॱ(anc o_anc, int i) {
        Object obj = o_anc.ˏ;
        int ˋ = o_anc.ˋ();
        int i2 = i;
        while (ˋ + 1 < i2) {
            if ((obj[ˋ] & 255) == 255 && obj[ˋ + 1] == (byte) 0) {
                System.arraycopy(obj, ˋ + 2, obj, ˋ + 1, (i2 - ˋ) - 2);
                i2--;
            }
            ˋ++;
        }
        return i2;
    }

    private static String ˎ(int i) {
        switch (i) {
            case 1:
                return "UTF-16";
            case 2:
                return "UTF-16BE";
            case 3:
                return "UTF-8";
            default:
                return "ISO-8859-1";
        }
    }

    private static String ˊ(int i, int i2, int i3, int i4, int i5) {
        if (i == 2) {
            return String.format(Locale.US, "%c%c%c", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4)});
        }
        return String.format(Locale.US, "%c%c%c%c", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5)});
    }

    private static int ˎ(byte[] bArr, int i, int i2) {
        int ॱ = ॱ(bArr, i);
        if (i2 == 0 || i2 == 3) {
            return ॱ;
        }
        while (ॱ < bArr.length - 1) {
            if (ॱ % 2 == 0 && bArr[ॱ + 1] == (byte) 0) {
                return ॱ;
            }
            ॱ = ॱ(bArr, ॱ + 1);
        }
        return bArr.length;
    }

    private static int ॱ(byte[] bArr, int i) {
        while (i < bArr.length) {
            if (bArr[i] == (byte) 0) {
                return i;
            }
            i++;
        }
        return bArr.length;
    }

    private static int ˏ(int i) {
        return (i == 0 || i == 3) ? 1 : 2;
    }

    private static byte[] ॱ(byte[] bArr, int i, int i2) {
        if (i2 <= i) {
            return anr.ʽ;
        }
        return Arrays.copyOfRange(bArr, i, i2);
    }

    private static String ˊ(byte[] bArr, int i, int i2, String str) throws UnsupportedEncodingException {
        if (i2 <= i || i2 > bArr.length) {
            return "";
        }
        return new String(bArr, i, i2 - i, str);
    }
}
